/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package services;

import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author Asko
 */
public class IntegerInputStream extends InputStream{
    
    int [] arr ;
    int counter = 0  ;
    public IntegerInputStream(int [] arr) {
        this.arr = arr ;
        System.out.println("Array length " + arr.length );
    }

    @Override
    public int read() throws IOException {
        /*if ((counter+1 < arr.length ? arr[counter+1] : arr[0]) == -1 ) 
         System.out.println("Jigurda");   */    
        
          return counter < arr.length ? arr[counter++] : -1 ;
         
    }
    
}
